package com.ruoyi.business.service.impl;

import com.ruoyi.business.domain.TAccountLog;
import com.ruoyi.business.mapper.TAccountLogMapper;
import com.ruoyi.business.service.ITAccountLogService;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 账变流水Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-26
 */
@Service
public class TAccountLogServiceImpl implements ITAccountLogService 
{
    @Autowired
    private TAccountLogMapper tAccountLogMapper;

    /**
     * 查询账变流水
     * 
     * @param id 账变流水主键
     * @return 账变流水
     */
    @Override
    public TAccountLog selectTAccountLogById(Long id)
    {
        return tAccountLogMapper.selectTAccountLogById(id);
    }

    /**
     * 查询账变流水列表
     * 
     * @param tAccountLog 账变流水
     * @return 账变流水
     */
    @Override
    @DataScope(userAlias = "t")
    public List<TAccountLog> selectTAccountLogList(TAccountLog tAccountLog)
    {
        return tAccountLogMapper.selectTAccountLogList(tAccountLog);
    }

    @Override
    public List<TAccountLog> selectTAccountLogListByNoAuth(TAccountLog tAccountLog) {
        return tAccountLogMapper.selectTAccountLogListByNoAuth(tAccountLog);
    }

    /**
     * 新增账变流水
     * 
     * @param tAccountLog 账变流水
     * @return 结果
     */
    @Override
    public int insertTAccountLog(TAccountLog tAccountLog)
    {
        tAccountLog.setCreateTime(DateUtils.getNowDate());
        return tAccountLogMapper.insertTAccountLog(tAccountLog);
    }

    /**
     * 修改账变流水
     * 
     * @param tAccountLog 账变流水
     * @return 结果
     */
    @Override
    public int updateTAccountLog(TAccountLog tAccountLog)
    {
        tAccountLog.setUpdateTime(DateUtils.getNowDate());
        return tAccountLogMapper.updateTAccountLog(tAccountLog);
    }

    /**
     * 批量删除账变流水
     * 
     * @param ids 需要删除的账变流水主键
     * @return 结果
     */
    @Override
    public int deleteTAccountLogByIds(String ids)
    {
        return tAccountLogMapper.deleteTAccountLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除账变流水信息
     * 
     * @param id 账变流水主键
     * @return 结果
     */
    @Override
    public int deleteTAccountLogById(Long id)
    {
        return tAccountLogMapper.deleteTAccountLogById(id);
    }
}
